package com.sy.auto.interceptor;

import com.sy.auto.token.TokenAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@AutoConfiguration(after = {TokenAutoConfiguration.class})
@ConditionalOnClass({WebMvcConfigurer.class})
@EnableConfigurationProperties({ValidationProperties.class})
@ConditionalOnProperty(prefix = "token.web",name="enabled",matchIfMissing = true)
public class TokenValidationAutoConfiguration {
    @Bean
    public TokenInterceptor tokenInterceptor(){
        return new TokenInterceptor();
    }
    @Bean
    public WebMvcConfig webMvcConfig(){
        return new WebMvcConfig();
    }
}
